package com.eastchina.fids2focs.service;

import java.util.List;

import javax.jws.WebService;

import org.springframework.beans.factory.annotation.Autowired;

import com.eastchina.fids2focs.common.FIDSIIError;
import com.eastchina.fids2focs.common.FIDSIIErrors;
import com.eastchina.fids2focs.common.exception.FIDSIIValidateException;
import com.eastchina.fids2focs.common.util.FIDSIIUtil;
import com.eastchina.fids2focs.domain.VFlightLeg;
import com.eastchina.fw.database.dao.QueryDAO;

@WebService(serviceName="DemoService", 
		endpointInterface="com.eastchina.fids2focs.service.DemoService")
public class DemoServiceImpl implements DemoService {

	/**
	 * 查询DAO
	 */
	@Autowired
	QueryDAO queryDAO;
	
	/**
	 * <p>查询所有航班行程<p>
	 * @return 航班行程
	 */
	public List<VFlightLeg> selectAllFlightLegs() {
		// 查询航班行程 (全件检索)
		return queryDAO.executeForObjectList("V_FLIGHT_LEG.selectAllFlightLegs", QueryDAO.EMPTY_PARAMS);
	}

	// Validate DEMO
	public void validate() throws FIDSIIValidateException {
		FIDSIIErrors errors = new FIDSIIErrors();
		
		// check
		errors.addError(new FIDSIIError("sysmgr.AE1001", "username"));
		errors.addError(new FIDSIIError("sysmgr.AE1001", "password"));
		
		throw new FIDSIIValidateException("DemoService#validate() Error.", errors);
	}
	
	public String getMacAddr() {
		return FIDSIIUtil.getMacAddr();
	}
}
